import Vue from 'vue'
import Router from 'vue-router'
import Mainpage from '@/components/Admin/Mainpage'
import HealthPost from '@/components/User/HealthPost'
import Login from '@/components/Login/Login'
import Overview from '@/components/Admin/Overview'
import Unhealth from '@/components/Admin/Analyse/Unhealth'
import DangerTrip from '@/components/Admin/Analyse/DangerTrip'
import notfound from '@/components/Util/404'
import UserManage from '@/components/Admin/UserManage'
import UnPostInfo from '@/components/Admin/UnPostInfo'
Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/adminpage',
      component: Mainpage,
      children: [{
        path: '/healthpost',
        components: {
          maincontent: HealthPost
        }
      },
      {
        path: '/admin',
        components: {
          maincontent: Overview
        }
      },
      {
        path: '/admin/Unhealth',
        components: {
          maincontent: Unhealth
        }
      },
      {
        path: '/admin/DangerTrip',
        components: {
          maincontent: DangerTrip
        }
      },
      {
        path: '/admin/usermanage',
        components: {
          maincontent: UserManage
        }
      },
      {
        path: '/admin/unpostInfo',
        components: {
          maincontent: UnPostInfo
        }
      }
      ]
    },
    {
      path: '/login',
      name: 'login', // 还是有用的，配置路由时可作id用
      component: Login
    },
    {
      path: '/',
      component: HealthPost
    },
    {
      path: '*',
      component: notfound
    },
    {
      path: '/404',
      component: notfound
    }
  ]
})
